package com.ruoyi.handing.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.handing.domain.AlgsStaffHanding;
import com.ruoyi.handing.service.IAlgsStaffHandingService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 处理员工Controller
 * 
 * @author ruoyi
 * @date 2023-03-20
 */
@RestController
@RequestMapping("/staffHanding")
public class AlgsStaffHandingController extends BaseController
{
    @Autowired
    private IAlgsStaffHandingService algsStaffHandingService;

    /**
     * 查询处理员工列表
     */
//    @RequiresPermissions("staffHanding:staffHanding:list")
    @GetMapping("/list")
    public TableDataInfo list(AlgsStaffHanding algsStaffHanding)
    {
        startPage();
        List<AlgsStaffHanding> list = algsStaffHandingService.selectAlgsStaffHandingList(algsStaffHanding);
        return getDataTable(list);
    }

    /**
     * 导出处理员工列表
     */
//    @RequiresPermissions("staffHanding:staffHanding:export")
    @Log(title = "处理员工", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, AlgsStaffHanding algsStaffHanding)
    {
        List<AlgsStaffHanding> list = algsStaffHandingService.selectAlgsStaffHandingList(algsStaffHanding);
        ExcelUtil<AlgsStaffHanding> util = new ExcelUtil<AlgsStaffHanding>(AlgsStaffHanding.class);
        util.exportExcel(response, list, "处理员工数据");
    }

    /**
     * 获取处理员工详细信息
     */
//    @RequiresPermissions("staffHanding:staffHanding:query")
    @GetMapping(value = "/{staffHandingId}")
    public AjaxResult getInfo(@PathVariable("staffHandingId") Long staffHandingId)
    {
        return success(algsStaffHandingService.selectAlgsStaffHandingByStaffHandingId(staffHandingId));
    }

    /**
     * 新增处理员工
     */
//    @RequiresPermissions("staffHanding:staffHanding:add")
    @Log(title = "处理员工", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AlgsStaffHanding algsStaffHanding)
    {
        return toAjax(algsStaffHandingService.insertAlgsStaffHanding(algsStaffHanding));
    }

    /**
     * 修改处理员工
     */
//    @RequiresPermissions("staffHanding:staffHanding:edit")
    @Log(title = "处理员工", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody AlgsStaffHanding algsStaffHanding)
    {
        return toAjax(algsStaffHandingService.updateAlgsStaffHanding(algsStaffHanding));
    }

    /**
     * 删除处理员工
     */
//    @RequiresPermissions("staffHanding:staffHanding:remove")
    @Log(title = "处理员工", businessType = BusinessType.DELETE)
	@DeleteMapping("/{staffHandingIds}")
    public AjaxResult remove(@PathVariable Long[] staffHandingIds)
    {
        return toAjax(algsStaffHandingService.deleteAlgsStaffHandingByStaffHandingIds(staffHandingIds));
    }
}
